home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
prodpack.zip
/
DB4PPSRC.EXE
/
_DLEXEC.PRG
< prev
next >
Wrap
Text File
|
1993-05-04
|
8KB
|
303 lines
PROCEDURE _DLExec
PARAMETERS pc_panel, pc_file
*---------------------------------------------------------------------
* NAME
* _FXExec - Control Center Execution program for the Forms panel
*
* DESCRIPTION
* _FXExec is the <execution> program for the Control Center when
* executed from the Forms panel. _FXExec performs the tasks that
* the Control Center would normally perform if the <execution>
* program was not assigned. These functions are as follows:
*
* - Check to see if a database or view is in use
* - If not open,
* + Open the database or view
* - Otherwise
* + Check to see if the file open is the one assigned to the catalog
* + If not,
* - Display the dialog box indicating current view or DBF/QBE name
* - Use the database or view selected by the user
* - If its a nornal SCR, FMO, or FMT file, SET FORMAT TO it
* - Otherwise,
* + Is TAG field for SCR object set to "PRG"
* - Run the SCR file as a PRG for multi-file forms, return to master
* + If the object file a PRG, if so, do it, and return to master
*
* PARAMETERS
* pc_panel = "FORM" for forms panel
* pc_file = name of the file selected with full path
*---------------------------------------------------------------------
SET ECHO OFF
PRIVATE lc_err, lc_fullpre, lc_quess, lc_scbname, lc_scrext, lc_trypath, ;
ll_dbtrap, ll_loaded, ll_talk, lc_ctnm
ll_talk = _TalkMode( .F. )
lc_ctnm = CATALOG()
PUBLIC fxl_escape, fxl_exact, fxl_fields, fxl_near, fxl_safety, fxc_dbtrap, ;
fxl_isscb, fxc_mastdb, fxl_talk, fxl_trap
STORE .F. TO fxl_talk, ;
fxl_near, ;
fxl_exact, ;
fxl_safety, ;
fxl_escape, ;
fxl_fields, ;
fxl_trap
DO _FXEcSEnv && Set the operating environment
fxl_talk = ll_talk
IF .NOT. FILE( pc_file )
lc_quess = _FileRoot( pc_file ) + "." + _FileType( pc_file )
lc_trypath = _FFile( lc_quess )
IF .NOT. ISBLANK( lc_trypath )
pc_file = lc_trypath + lc_quess
IF .NOT. FILE( pc_file )
DO _Err_Box WITH [Cannot locate design file based on path: ] + pc_file
IF LASTKEY() = 28
DO _Helpsys WITH "_FXZERR", "XXNOSCR"
ENDIF
DO _FXEcREnv && Restore the operating environment
IF _TalkMode( ll_talk )
ENDIF
RETURN TO MASTER
ENDIF
ENDIF
ENDIF
lc_err = [Do not know what to do with file: ]
*-- Determine if the form has any Special F/X
fxc_dbtrap = ""
fxl_isscb = .T.
fxc_dbtrap = SET( "DBTRAP" )
SET DBTRAP OFF
ll_dbtrap = SET( "DBTRAP" ) = "ON"
SET DBTRAP OFF
ll_loaded = .F.
DO _SetOnEr
DO _fxUseIt WITH pc_file, ll_loaded, fxl_isscb
ON ERROR
IF ll_dbtrap
SET DBTRAP ON
ENDIF
IF .NOT. ll_loaded .AND. ISBLANK( FXC_CTAG )
IF ISBLANK( ALIAS() )
DO _Err_Box WITH [No database in use, returning back to Control Center]
IF LASTKEY() = 28
DO _Helpsys WITH "_FXZERR", "XXNODBF"
ENDIF
ENDIF
IF fxl_isscb .AND. fxc_dbtrap = "ON"
SET DBTRAP ON
ENDIF
RELEASE FXC_ctag
DO _FXEcREnv && Reset the operating environment
RETURN TO MASTER && Exit without going to EDIT/BROWSE
ENDIF
lc_fullpre = pc_file
DO _FullPre WITH lc_fullpre
lc_scrext = _FileType( pc_file )
fxc_mastdb = ALIAS()
FXC_qrep = lc_fullpre
*-- Execute the SET FORMAT or DO based on the file type
DO CASE
CASE lc_scrext $ "SCR,FMT,FMO"
IF ISBLANK( FXC_ctag )
*-- Normal EDIT/BROWSE format file
IF FILE( lc_fullpre + ".FMT" ) .OR. FILE( lc_fullpre + ".FMO" )
SET FORMAT TO ( lc_fullpre )
IF fxl_isscb
RELEASE FXL_Edit
PUBLIC FXL_Edit
FXL_Edit = .T.
DO _SetOnEr
EDIT
IF TYPE("FXL_ERROR") = "L" .AND. FXL_ERROR
*-- Start clearing .dbf out of all other workareas past 1
CLOSE DATABASES
IF .NOT. ISBLANK( fxc_mastdb )
DO _OpenDBF WITH fxc_mastdb, 1, .T.
ENDIF
ENDIF
ON ERROR
RELEASE FXL_Edit, FXL_Error
IF fxl_isscb .AND. fxc_dbtrap = "ON"
SET DBTRAP ON
ENDIF
RELEASE FXC_ctag
DO _FXEcREnv && Reset the operating environment
RETURN TO MASTER && Exit without going to EDIT/BROWSE
ENDIF
ELSE
DO _Err_Box WITH [File not found: ] + lc_fullpre + ".FMT"
IF LASTKEY() = 28
DO _Helpsys WITH "_FXZERR", "XXNOFMT"
ENDIF
IF fxl_isscb .AND. fxc_dbtrap = "ON"
SET DBTRAP ON
ENDIF
RELEASE FXC_ctag
DO _FXEcREnv && Reset the operating environment
RETURN TO MASTER && Exit without going to EDIT/BROWSE
ENDIF
ELSE
*-- Check for multi-file/multi-record form
IF FXC_ctag = "DLG"
*-- It is, so run the SCR as a PRG
IF FILE( lc_fullpre + ".PRG" )
RELEASE FXL_Edit
PUBLIC FXL_Edit
FXL_Edit = .F.
DO _SetOnEr && Set on error based on FXL_DEV
IF TYPE( "FXL_DEV" ) = "L" .AND. FXL_DEV
SET TRAP ON
SET ESCAPE ON
ELSE
SET TRAP OFF
SET ESCAPE OFF
ENDIF
RELEASE cColorEnv
PUBLIC cColorEnv
cColorEnv = SET( "ATTRIB" )
lcPrgName = _FileRoot( pc_file )
DO &lcPrgName
IF TYPE("FXL_ERROR") = "L" .AND. FXL_ERROR
*-- Start clearing .dbf out of all other workareas past 1
CLOSE DATABASES
IF .NOT. ISBLANK( fxc_mastdb )
DO _OpenDBF WITH fxc_mastdb, 1, .T.
ENDIF
SET CURSOR ON
cColorPost = _ColorSet( cColorEnv )
ENDIF
RELEASE cColorEnv
ON ERROR
RELEASE FXL_Edit, FXL_Error
ELSE
DO _Err_Box WITH [File not found: ] + lc_fullpre + ".PRG"
IF LASTKEY() = 28
DO _Helpsys WITH "_FXZERR", "XXNOPRG"
ENDIF
ENDIF
IF fxl_isscb .AND. fxc_dbtrap = "ON"
SET DBTRAP ON
ENDIF
IF .NOT. ISBLANK( lc_ctnm )
SET CATALOG TO &lc_ctnm
ENDIF
SELECT 1
RELEASE FXC_ctag
DO _FXEcREnv && Reset the operating environment
SELECT 1 && All this is to get the catalog
IF .NOT. ISBLANK( ALIAS() ) && to put the file in use, back
USE ( ALIAS() ) && above the line.
ENDIF
RETURN TO MASTER && Exit without going to EDIT/BROWSE
ELSE
DO _Err_Box WITH lc_err + pc_file
IF LASTKEY() = 28
DO _Helpsys WITH "_FXZERR", "XXUNKFIL"
ENDIF
ENDIF
ENDIF
OTHERWISE
*-- Don't recognize the file type, go to EDIT/BROWSE without FORMAT
DO _Err_Box WITH lc_err + pc_file
IF LASTKEY() = 28
DO _Helpsys WITH "_FXZERR", "XXUNKFIL"
ENDIF
RELEASE FXC_ctag
DO _FXEcREnv && Reset the operating environment
RETURN TO MASTER && Exit without going to EDIT/BROWSE
ENDCASE
RELEASE FXC_ctag
IF fxc_dbtrap = "ON"
SET DBTRAP ON
ENDIF
DO _FXEcREnv && Reset the operating environment
RETURN
*-- EOP: _DLExec WITH pc_panel, pc_file